    <div class="tab-content">
        <div id="tool1" class="tab-pane active">
            <table class="sui-table table-bordered">
                <thead>
                    <tr>
                        <th colspan="4">日期时间</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>日期时间转时间戳:</td>
                        <td>
                            <input type="text" placeholder="输入日期时间" class="input-xfat" id="dateTime" value="<?php echo date('Y-m-d H:i:s'); ?>">
                        </td>
                        <td><input type="button" class="sui-btn btn-success" name="a" value="转换" onclick="ToTimeStamp()"></td>
                        <td>
                            <input type="text" placeholder="转换后的时间戳(秒)" class="input-xfat" id="result_timeStamp">
                        </td>
                    </tr>
                    <tr>
                        <td>时间戳转日期时间:</td>
                        <td>
                            <input type="text" placeholder="输入时间戳(秒)" class="input-xfat" id="timeStamp" value="<?php echo time(); ?>">
                        </td>
                        <td><input type="button" class="sui-btn btn-success" name="a" value="转换" onclick="ToDateTime()"></td>
                        <td>
                            <input type="text" placeholder="转换后的日期时间" class="input-xfat" id="result_dateTime">
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
        <div id="tool2" class="tab-pane active">
            <table class="sui-table table-bordered">
                <thead>
                    <tr>
                        <th colspan="4">加密</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>MD5:</td>
                        <td>
                            <input type="text" placeholder="输入明文密码" class="input-xfat" id="md5" value="">
                        </td>
                        <td><input type="button" class="sui-btn btn-success" name="a" value="加密" onclick="ToMd5()"></td>
                        <td>
                            <input type="text" placeholder="md5内容" class="input-xfat" id="result_md5">
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
        <div id="tool2" class="tab-pane active">
            <table class="sui-table table-bordered">
                <thead>
                <tr>
                    <th colspan="4">字符</th>
                </tr>
                </thead>
                <tbody>
                <tr>
                    <td>长度:</td>
                    <td>
                        <input type="text" placeholder="输入字符串" class="input-xfat" id="string_len" value="">
                    </td>
                    <td><input type="button" class="sui-btn btn-success" name="a" value="计算长度" onclick="ToStrLen()"></td>
                    <td>
                        <input type="text" placeholder="字符串长度" class="input-xfat" id="result_string_len">
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
    </div>


<script type="text/javascript">
    var ajax_page_type= 1; //防重复请求
    var ajax_page_params_type= 1; //防重复请求

    //日期时间转时间戳
    function ToTimeStamp(){
        var val=$('#dateTime').val();
        if(!val.length>0){ return false; }
        if(ajax_page_type==0){ msgLogin();return false; }else{ ajax_page_type=0; }

        $.get('<?php echo Yii::app()->request->baseUrl; ?>/tool/ajaxTool', {type: 1,val: val}, function (data) {
            if (data) {
                if(data.code==200){
                    $('#result_timeStamp').val(data.obj.val);ajax_page_type=1;
                }else{
                    showMsg(data.msg);ajax_page_type=1;
                }
            } else {
                msgError();
                ajax_page_type=1;
            }
        });
    }

    //时间戳转日期时间
    function ToDateTime(){
        var val=$('#timeStamp').val();
        if(!val.length>0){ return false; }
        if(ajax_page_type==0){ msgLogin();return false; }else{ ajax_page_type=0; }

        $.get('<?php echo Yii::app()->request->baseUrl; ?>/tool/ajaxTool', {type: 2,val: val}, function (data) {
            if (data) {
                if(data.code==200){
                    $('#result_dateTime').val(data.obj.val);ajax_page_type=1;
                }else{
                    showMsg(data.msg);ajax_page_type=1;
                }
            } else {
                msgError();
                ajax_page_type=1;
            }
        });
    }
    //字符串转MD5
    function ToMd5(){
        var val=$('#md5').val();
        if(!val.length>0){ return false; }
        if(ajax_page_type==0){ msgLogin();return false; }else{ ajax_page_type=0; }

        $.get('<?php echo Yii::app()->request->baseUrl; ?>/tool/ajaxTool', {type: 3,val: val}, function (data) {
            if (data) {
                if(data.code==200){
                    $('#result_md5').val(data.obj.val);ajax_page_type=1;
                }else{
                    showMsg(data.msg);ajax_page_type=1;
                }
            } else {
                msgError();
                ajax_page_type=1;
            }
        });
    }

    //字符串返回出度
    function ToStrLen(){
        var val=$('#string_len').val();
        if(!val.length>0){ return false; }
        if(ajax_page_type==0){ msgLogin();return false; }else{ ajax_page_type=0; }

        $.get('<?php echo Yii::app()->request->baseUrl; ?>/tool/ajaxTool', {type: 4,val: val}, function (data) {
            if (data) {
                if(data.code==200){
                    $('#result_string_len').val(data.obj.val);ajax_page_type=1;
                }else{
                    showMsg(data.msg);ajax_page_type=1;
                }
            } else {
                msgError();
                ajax_page_type=1;
            }
        });
    }


</script>